package cn.usts.deu.controller;


import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import cn.usts.deu.pojo.User;

@Controller
public class UserController {

//    http://localhost:8080/t1?username=hello   输出  【hello】
    @RequestMapping("/t1")
    public String u1(@RequestParam("username") String username,Model model){
        model.addAttribute("msg",username);
        System.out.println(username);
        return "test";

    }

//    http://localhost:8080/t2?id=12&age=18&name=tom   输出：【User{id=12, name='tom', age=18}】
    @RequestMapping("/t2")
    public String u2(User user,Model model){
        model.addAttribute("msg",user);
        return "test";
    }

    @RequestMapping("/t3")
    public String t3(Model model,String name){
        model.addAttribute("msg",name);
        return "test";
    }


}
